﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Chapter23.View
{
    using Chapter23.Properties;
    /// <summary>
    /// SavePosition.xaml 的交互逻辑
    /// </summary>
    public partial class SavePosition : Window
    {
        public SavePosition()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Settings.Default.WindowPostion = RestoreBounds;
            Settings.Default.Save();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                var bounds = Settings.Default.WindowPostion;
                Top = bounds.Top;
                Left = bounds.Left;
                if (SizeToContent==SizeToContent.Manual)
                {
                    Width = bounds.Width;
                    Height = bounds.Height;
                }
            }
            catch
            {
                MessageBox.Show("没有存储配置");
            }
        }
    }
}
